import { createStore } from "vuex";
import vuexp from "vuex-persistedstate";
export default createStore({
  state: {
    token: "", //标记用户登录状态
    userInfo: {}, //用户信息
    addGoodsForm: {},
    goodsFormType: {},
  },
  getters: {},
  mutations: {
    setToken: (state, payload) => {
      state.token = payload;
    },
    saveUserInfo(state, payload) {
      state.userInfo = payload;
    },
    setAddGoodsForm: (state, payload) => {
      Object.assign(state.addGoodsForm, payload);
    },
    clearAddGoodsFrom: (state) => {
      state.addGoodsForm = {};
    },
  },
  actions: {},
  modules: {},
  plugins: [vuexp()],
});
